/**
 * createRouter 这个为创建路由的方法
 * createWebHashHistory 这个就是vue2中路由的模式，
 *                      这里的是hash模式，这个还可以是createWebHistory等
 * RouteRecordRaw 这个为要添加的路由记录，也可以说是routes的ts类型
 */
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"

// 路由记录
const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "index",
    meta: { title: "首页" },
    component: () => import("@/views/index/Index.vue")
  },
  {
    path: "/console/login",
    name: "console/login",
    meta: { title: "控制端登录" },
    component: () => import("@/views/console/Login.vue")
  },
  {
    path: "/console/index",
    name: "console/index",
    meta: { title: "控制端首页" },
    component: () => import("@/views/console/Index.vue")
  },
  {
    path: "/client/login",
    name: "client/login",
    meta: { title: "客户端登录" },
    component: () => import("@/views/client/Login.vue")
  },
  {
    path: "/client/index",
    name: "client/index",
    meta: { title: "客户端首页" },
    component: () => import("@/views/client/Index.vue")
  }
]

// 创建路由
const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
